package com.rule.easyrule;

import com.rule.easyrule.service.BizRuleService;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Arrays;

@RestController
@EnableAutoConfiguration
@ComponentScan("com.rule.easyrule.service;com.rule.easyrule.mapper")
public class EasyruleApplication {
    @Autowired
    private BizRuleService bizRuleService;

    public static void main(String[] args) {
        try{//这里捕获异常 为了 方便查看 启动失败的原因
            SpringApplication.run(EasyruleApplication.class, args);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    @Autowired
    private ApplicationContext applicationContext;

    @RequestMapping("/")
    String home(){
        String[] beanDefinitionNames = applicationContext.getBeanDefinitionNames();
        System.out.println( Arrays.asList(beanDefinitionNames));
        return "hello world";
    }

}
